1 <?php
2 // This script and data application were generated
by AppGini 5.72
3 // Download AppGini
for free from https://bigprof.com/appgini/download/
4
5     $currDir=dirname(__FILE__);
6     include(
"$currDir/defaultLang.php");
7     include(
"$currDir/language.php");
8     include(
"$currDir/lib.php");
9     @include(
"$currDir/hooks/departments.php");
10     include(
"$currDir/departments_dml.php");
11
12     
// mm: can the current member access this page?
13     $perm=getTablePermissions(
'departments');
14     
if(!$perm[0]){
15         echo error_message($Translation[
'tableAccessDenied'], false);
16         echo
'<script>setTimeout("window.location=\'index.php?signOut=1\'", 2000);</script>';
17         exit;
18     }
19
20     $x =
new DataList;
21     $x->TableName =
"departments";
22
23     
// Fields that can be displayed in the table view
24     $x->QueryFieldsTV = array(
25         
"`departments`.`id`" => "id",
26         
"`departments`.`name`" => "name",
27         
"IF( CHAR_LENGTH(`schools1`.`name`), CONCAT_WS('', `schools1`.`name`), '') /* School */" => "school"
28     );
29     
// mapping incoming sort by requests to actual query fields
30     $x->SortFields = array(
31         
1 => '`departments`.`id`',
32         
2 => 2,
33         
3 => '`schools1`.`name`'
34     );
35
36     
// Fields that can be displayed in the csv file
37     $x->QueryFieldsCSV = array(
38         
"`departments`.`id`" => "id",
39         
"`departments`.`name`" => "name",
40         
"IF( CHAR_LENGTH(`schools1`.`name`), CONCAT_WS('', `schools1`.`name`), '') /* School */" => "school"
41     );
42     
// Fields that can be filtered
43     $x->QueryFieldsFilters = array(
44         
"`departments`.`id`" => "ID",
45         
"`departments`.`name`" => "Name",
46         
"IF( CHAR_LENGTH(`schools1`.`name`), CONCAT_WS('', `schools1`.`name`), '') /* School */" => "School"
47     );
48
49     
// Fields that can be quick searched
50     $x->QueryFieldsQS = array(
51         
"`departments`.`id`" => "id",
52         
"`departments`.`name`" => "name",
53         
"IF( CHAR_LENGTH(`schools1`.`name`), CONCAT_WS('', `schools1`.`name`), '') /* School */" => "school"
54     );
55
56     
// Lookup fields that can be used as filterers
57     $x->filterers = array(
'school' => 'School');
58
59     $x->QueryFrom =
"`departments` LEFT JOIN `schools` as schools1 ON `schools1`.`id`=`departments`.`school` ";
60     $x->QueryWhere =
'';
61     $x->QueryOrder =
'';
62
63     $x->AllowSelection =
1;
64     $x->HideTableView = ($perm[
2]==0 ? 1 : 0);
65     $x->AllowDelete = $perm[
4];
66     $x->AllowMassDelete =
true;
67     $x->AllowInsert = $perm[
1];
68     $x->AllowUpdate = $perm[
3];
69     $x->SeparateDV =
1;
70     $x->AllowDeleteOfParents =
0;
71     $x->AllowFilters =
1;
72     $x->AllowSavingFilters =
0;
73     $x->AllowSorting =
1;
74     $x->AllowNavigation =
1;
75     $x->AllowPrinting =
1;
76     $x->AllowCSV =
1;
77     $x->RecordsPerPage =
100;
78     $x->QuickSearch =
1;
79     $x->QuickSearchText = $Translation[
"quick search"];
80     $x->ScriptFileName =
"departments_view.php";
81     $x->RedirectAfterInsert =
"departments_view.php?SelectedID=#ID#";
82     $x->TableTitle =
"Môn học";
83     $x->TableIcon =
"resources/table_icons/chart_organisation.png";
84     $x->PrimaryKey =
"`departments`.`id`";
85
86     $x->ColWidth = array(
150, 150);
87     $x->ColCaption = array(
"Tên Môn học", "Lớp học");
88     $x->ColFieldName = array(
'name', 'school');
89     $x->ColNumber = array(
2, 3);
90
91     
// template paths below are based on the app main directory
92     $x->Template =
'templates/departments_templateTV.html';
93     $x->SelectedTemplate =
'templates/departments_templateTVS.html';
94     $x->TemplateDV =
'templates/departments_templateDV.html';
95     $x->TemplateDVP =
'templates/departments_templateDVP.html';
96
97     $x->ShowTableHeader =
1;
98     $x->TVClasses =
"";
99     $x->DVClasses =
"";
100     $x->HighlightColor =
'#FFF0C2';
101
102     
// mm: build the query based on current member's permissions
103     $DisplayRecords = $_REQUEST[
'DisplayRecords'];
104     
if(!in_array($DisplayRecords, array('user', 'group'))){ $DisplayRecords = 'all'; }
105     
if($perm[2]==1 || ($perm[2]>1 && $DisplayRecords=='user' && !$_REQUEST['NoFilter_x'])){ // view owner only
106         $x->QueryFrom.=
', membership_userrecords';
107         $x->QueryWhere=
"where `departments`.`id`=membership_userrecords.pkValue and membership_userrecords.tableName='departments' and lcase(membership_userrecords.memberID)='".getLoggedMemberID()."'";
108     }elseif($perm[
2]==2 || ($perm[2]>2 && $DisplayRecords=='group' && !$_REQUEST['NoFilter_x'])){ // view group only
109         $x->QueryFrom.=
', membership_userrecords';
110         $x->QueryWhere=
"where `departments`.`id`=membership_userrecords.pkValue and membership_userrecords.tableName='departments' and membership_userrecords.groupID='".getLoggedGroupID()."'";
111     }elseif($perm[
2]==3){ // view all
112         
// no further action
113     }elseif($perm[
2]==0){ // view none
114         $x->QueryFields = array(
"Not enough permissions" => "NEP");
115         $x->QueryFrom =
'`departments`';
116         $x->QueryWhere =
'';
117         $x->DefaultSortField =
'';
118     }
119     
// hook: departments_init
120     $render=TRUE;
121     
if(function_exists('departments_init')){
122         $args=array();
123         $render=departments_init($x, getMemberInfo(), $args);
124     }
125
126     
if($render) $x->Render();
127
128     
// hook: departments_header
129     $headerCode=
'';
130     
if(function_exists('departments_header')){
131         $args=array();
132         $headerCode=departments_header($x->ContentType, getMemberInfo(), $args);
133     }
134     
if(!$headerCode){
135         include_once(
"$currDir/header.php");
136     }
else{
137         ob_start(); include_once(
"$currDir/header.php"); $dHeader=ob_get_contents(); ob_end_clean();
138         echo str_replace(
'<%%HEADER%%>', $dHeader, $headerCode);
139     }
140
141     echo $x->HTML;
142     
// hook: departments_footer
143     $footerCode=
'';
144     
if(function_exists('departments_footer')){
145         $args=array();
146         $footerCode=departments_footer($x->ContentType, getMemberInfo(), $args);
147     }
148     
if(!$footerCode){
149         include_once(
"$currDir/footer.php");
150     }
else{
151         ob_start(); include_once(
"$currDir/footer.php"); $dFooter=ob_get_contents(); ob_end_clean();
152         echo str_replace(
'<%%FOOTER%%>', $dFooter, $footerCode);
153     }
154 ?>



Hệ thống xếp lịch học tín chỉ cho sinh viên CNTT trên PHP & MySQL 111.159 lượt xem

Gõ tìm kiếm nhanh...